using System;

namespace BSDS.Core.Model.Services.Jobs.Core
{
    public class JobState
    {
        public string Id { get; private set; }
        public JobStatus Status { get; private set; }
        public JobResult EndResult { get; private set; }
        public string AbortReason { get; private set; }
        public DateTime? CompletedDate { get; private set; }
        public bool DataAvailable
        {
            get
            {
                return Status == JobStatus.Completed &&
                       EndResult.ComplitionStatus == JobComplitionStatus.Success;
            }
        }

        public JobState(string id, JobStatus status, JobResult endResult, string abortReason, DateTime? completedDate)
        {
            Id = id;
            Status = status;
            EndResult = endResult;
            AbortReason = abortReason;
            CompletedDate = completedDate;
        }
    }
}